<template>
  <FormAndViewConfig v-if="visible" :genConfigId="genConfigId" :iProps="iProps" ref="form"></FormAndViewConfig>
</template>

<script>

  import FormAndViewConfig from '../FormAndViewConfig'

  export default {
    name: 'Step1',
    components: {
      FormAndViewConfig
    },
    props: {
      iProps: {
        type: Object,
        default: () => {
        }
      },
      genConfigId:{
        type:String,
        default:""
      }
    },
    data () {
      return {
        visible:false,
      }
    },
    methods: {
      prevStep () {
        this.visible = false
        this.$emit('prevStep')
      },
      nextStep () {
        this.handleOk().then(() => this.$emit('nextStep'))
      },
      save(){
        return this.$refs.form.save()
      },
      finish () {
        this.handleOk().then(() => this.$emit('finish'))
      },
      show () {
        this.visible = true
      },
      handleOk () {
        return this.save()
      }
    }
  }
</script>
